#include <stdio.h>
#define MaxSize 10

typedef struct TowWayStore
{
    int data[MaxSize];
    int top1, top2;
}Stk;

bool push(Stk s, int stackNum, int e) {
    if (s.top2 - s.top1 == 1)
        return false;
    switch (stackNum)
    {
    case 1:
        s.data[++s.top1] = e;
        break;
    case 2:
        s.data[--s.top2] = e;
        break;
    default:
        return false;
    }
    return true;
}

bool pop(Stk s, int stackNum, int &e) {
    switch (stackNum)
    {
    case 1:
        if (s.top1 == 0)
            return false;
        e = s.data[s.top1--];
        break;
    case 2:
        if (s.top2 == MaxSize)
            return false;
        e = s.data[s.top2++];
        break;
    default:
        return false;
    }
    return true;
}

int main(int argc, char const *argv[])
{
    
    return 0;
}
